home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
Other Langs
/
Tickle-4.0 (tcl)
/
src
/
tar.c
< prev
next >
Wrap
Text File
|
1993-11-06
|
3KB
|
119 lines
#pragma segment TAR
/*
* Macintosh TAR
*
* Written by Craig Ruff
*
* Main routine and global variables.
*/
#include "tar.h"
#include <SegLoad.h>
#include <Resources.h>
/*
* Global variable declarations
*/
Boolean autoPage = false; /* List by screenfulls */
Boolean cvtNl = false; /* Convert newline to return and back */
Boolean doneFlag = false; /* Quit item selected? */
Boolean doPrint = false; /* List to printer */
Boolean ignorez = false; /* Ignore zero blocks */
Boolean pOpen = false; /* Printer open? */
Boolean reblock = false; /* Read enough for a full block size buffer */
Boolean oldArch = false; /* Old tar compatible */
THPrint prRecHdl; /* Printer record (when printing) */
char *arName; /* Archive file name */
long arDirID; /* Archive file DirID */
short arVRefNum; /* Archive file VRefNum */
short archive; /* File descriptor for archive file */
int blocking; /* Size of each block, in records */
int blockSize; /* Size of each block, in bytes */
char fdCreator[4]; /* Finder Creator */
char fdType[4]; /* Finder Type */
char header[128]; /* Common header for listings */
jmp_buf errJmp; /* For error exits */
int tar_scripting = 0;
int tar_listing = 0;
int tar_list_format = 0;
Tcl_Interp *tar_interp = NULL;
tar_initialize()
{
short saveref;
Handle fTypeH;
extern short app_refnum;
saveref = CurResFile();
UseResFile(app_refnum);
tar_scripting = 0;
tar_listing = 0;
tar_list_format = 0;
tar_interp = NULL;
blocking = 20;
blockSize = blocking * RECORDSIZE;
if ((fTypeH = GetResource('ftyp', 0)) == NULL)
{
strncpy(fdCreator, "????", 4);
strncpy(fdType, "TEXT", 4);
}
else
{
strncpy(fdCreator, *fTypeH, 4);
strncpy(fdType, (*fTypeH) + 4, 4);
ReleaseResource(fTypeH);
}
if ((prRecHdl = (THPrint) NewHandle((long) sizeof(TPrint))) == NULL) {
OSAlert("\pmain", "\pNewHandle returned NULL", NULL, MemError());
ExitToShell();
}
sprintf(header, "T Size Date Name%*s", 40, "");
UseResFile(saveref);
}
tar_close()
{
if (pOpen)
PrClose();
}
Boolean
WindInit()
{
ShowFeedback();
return 0;
}
WindEnd(keyWait)
Boolean keyWait;
{
#pragma unused (keyWait)
/*if (! keyWait)
HideFeedback();*/
}
WPrintf(format, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
char *format;
long arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9;
{
/* long ticks = TickCount(); */
Feedback(format,
arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
}